Optimal. Leaf size=228 \[ -\frac {(a B+A b n) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {b \tan (c+d x)}{a}+1\right )}{a^2 d (n+1)}-\frac {(A-i B) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a-i b}\right )}{2 d (n+1) (b+i a)}+\frac {(A+i B) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a+i b}\right )}{2 d (n+1) (-b+i a)}-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.45, antiderivative size = 228, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.226, Rules used = {3609, 3653, 3539, 3537, 68, 3634, 65} \[ -\frac {(a B+A b n) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {b \tan (c+d x)}{a}+1\right )}{a^2 d (n+1)}-\frac {(A-i B) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a-i b}\right )}{2 d (n+1) (b+i a)}+\frac {(A+i B) (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a+i b}\right )}{2 d (n+1) (-b+i a)}-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{n+1}}{a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 65
Rule 68
Rule 3537
Rule 3539
Rule 3609
Rule 3634
Rule 3653
Rubi steps
\begin {align*} \int \cot ^2(c+d x) (a+b \tan (c+d x))^n (A+B \tan (c+d x)) \, dx &=-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac {\int \cot (c+d x) (a+b \tan (c+d x))^n \left (-a B-A b n+a A \tan (c+d x)-A b n \tan ^2(c+d x)\right ) \, dx}{a}\\ &=-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac {\int (a+b \tan (c+d x))^n (a A+a B \tan (c+d x)) \, dx}{a}+\frac {(a B+A b n) \int \cot (c+d x) (a+b \tan (c+d x))^n \left (1+\tan ^2(c+d x)\right ) \, dx}{a}\\ &=-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac {1}{2} (A-i B) \int (1+i \tan (c+d x)) (a+b \tan (c+d x))^n \, dx-\frac {1}{2} (A+i B) \int (1-i \tan (c+d x)) (a+b \tan (c+d x))^n \, dx+\frac {(a B+A b n) \operatorname {Subst}\left (\int \frac {(a+b x)^n}{x} \, dx,x,\tan (c+d x)\right )}{a d}\\ &=-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}-\frac {(a B+A b n) \, _2F_1\left (1,1+n;2+n;1+\frac {b \tan (c+d x)}{a}\right ) (a+b \tan (c+d x))^{1+n}}{a^2 d (1+n)}+\frac {(i A-B) \operatorname {Subst}\left (\int \frac {(a+i b x)^n}{-1+x} \, dx,x,-i \tan (c+d x)\right )}{2 d}-\frac {(i A+B) \operatorname {Subst}\left (\int \frac {(a-i b x)^n}{-1+x} \, dx,x,i \tan (c+d x)\right )}{2 d}\\ &=-\frac {A \cot (c+d x) (a+b \tan (c+d x))^{1+n}}{a d}+\frac {(i A+B) \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-i b}\right ) (a+b \tan (c+d x))^{1+n}}{2 (a-i b) d (1+n)}+\frac {(A+i B) \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+i b}\right ) (a+b \tan (c+d x))^{1+n}}{2 (i a-b) d (1+n)}-\frac {(a B+A b n) \, _2F_1\left (1,1+n;2+n;1+\frac {b \tan (c+d x)}{a}\right ) (a+b \tan (c+d x))^{1+n}}{a^2 d (1+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.42, size = 202, normalized size = 0.89 \[ \frac {(a+b \tan (c+d x))^{n+1} \left (a^2 (a+i b) (A-i B) \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a-i b}\right )-(a-i b) \left (a^2 (A+i B) \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a+i b}\right )+2 (b-i a) \left (a B \, _2F_1\left (1,n+1;n+2;\frac {b \tan (c+d x)}{a}+1\right )-A b \, _2F_1\left (2,n+1;n+2;\frac {b \tan (c+d x)}{a}+1\right )\right )\right )\right )}{2 a^2 d (n+1) (a-i b) (b-i a)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [F] time = 0.52, size = 0, normalized size = 0.00 \[ {\rm integral}\left ({\left (B \cot \left (d x + c\right )^{2} \tan \left (d x + c\right ) + A \cot \left (d x + c\right )^{2}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{n}, x\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [F] time = 1.12, size = 0, normalized size = 0.00 \[ \int \left (\cot ^{2}\left (d x +c \right )\right ) \left (a +b \tan \left (d x +c \right )\right )^{n} \left (A +B \tan \left (d x +c \right )\right )\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{n} \cot \left (d x + c\right )^{2}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [F] time = 0.00, size = -1, normalized size = -0.00 \[ \int {\mathrm {cot}\left (c+d\,x\right )}^2\,\left (A+B\,\mathrm {tan}\left (c+d\,x\right )\right )\,{\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}^n \,d x \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (A + B \tan {\left (c + d x \right )}\right ) \left (a + b \tan {\left (c + d x \right )}\right )^{n} \cot ^{2}{\left (c + d x \right )}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________